<title>Example Code</title>
<font SIZE="2">
<link href="edit68k.css" rel="stylesheet" type="text/css">

<h1 class="heading">EXAMPLE CODE<br><hr noshade></h1>
<p class="subheading">OUTPUT</p>
<p class="text">This code will display the text Hello World and the number 
contained in D1 on the following line. </p>
<p class="sourcecode" style="margin-top: 0; margin-bottom: 0">* Note! asterisk 
'*' in first column for comments<br>
* labels must start in first column<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ORG $1000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the program will load into address $1000<br>
<br>
* Display text greet<br>
* see Help/Simulator IO for a complete list of task numbers<br>
START&nbsp;&nbsp; MOVE&nbsp;&nbsp; #14,D0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; put text 
display task number in D0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LEA&nbsp;&nbsp;&nbsp; GREET,A1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; load address of string to display into A1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRAP&nbsp;&nbsp; #15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
activates input/output task<br>
<br>
* Display the contents of register D1<br>
* task number 3 is used to display the contents of D1.L as a number<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MOVE.L #12345678,D1&nbsp; put a 
number in D1 so we can display it</p>
<p class="sourcecode" style="margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
MOVE&nbsp;&nbsp; #3,d0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; task number 3 into D0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRAP&nbsp;&nbsp; #15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; display number in D1.l<br>
<br>
* Stop execution<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STOP&nbsp;&nbsp; #$2000<br>
<br>
GREET&nbsp;&nbsp; DC.B&nbsp;&nbsp; 'Hello World',$D,$A,0&nbsp;&nbsp;&nbsp; null terminated string 
with newline<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END&nbsp;&nbsp;&nbsp;&nbsp; START&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end of program with start address specified<br>
&nbsp;</p>
<p class="subheading">&nbsp;</p>
<p class="subheading">INPUT</p>
<p class="text">This code will read a number and a string from the keyboard</p>
<p class="sourcecode" style="margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ORG $1000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the program will load into address $1000<br>
&nbsp;</p>
<p class="sourcecode" style="margin-top: 0; margin-bottom: 0">* input a number 
into register D1.L</p>
<p class="sourcecode" style="margin-top: 0; margin-bottom: 0">START&nbsp;&nbsp; MOVE.B&nbsp; #4,D0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; trap code 4 
(read number into D1.L)</p>
<p class="sourcecode" style="margin-top: 0; margin-bottom: 0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRAP&nbsp;&nbsp;&nbsp; #15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
get number</p>
<p class="sourcecode" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p class="sourcecode" style="margin-top: 0; margin-bottom: 0">* input a string, 
store in BUFFER<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MOVE&nbsp;&nbsp; #2,D0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
read a string task number in D0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LEA&nbsp;&nbsp;&nbsp; BUFFER,A1&nbsp;&nbsp;&nbsp;&nbsp; load address of 
buffer for string into A1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRAP&nbsp;&nbsp; #15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
activates input/output task<br>
<br>
* Stop execution<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STOP&nbsp;&nbsp; #$2000<br>
<br>
BUFFER&nbsp; DS.B&nbsp;&nbsp; 80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
buffer for input string<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END&nbsp;&nbsp;&nbsp; START&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end of program with start address specified<br>
&nbsp;</p>
<p class="text">See Help and the EXAMPLES folder for more information and 
example code. More examples are also available at
<a href="http://www.easy68k.com">www.easy68k.com</a></p>
</font>
